{% extends "base.html" %}
{% load i18n %}
{% load markup %}

{% block title %}{% trans "User" %}{% endblock %}

{% block page-title %}
  {% trans "Profile for" %}: {{ user_to_show }}
{% endblock %}

{% block sub-navigation %}

{% endblock %}

{% block content %}

{% if user_to_show.first_name or user_to_show.last_name%}
  <div class="module">
	<h3 class="header">
	  {% trans 'Name' %}
	</h3>
	<div class="body">
		<div class="clearfix after">
		  <label for="id_first_name">{% trans "First name" %}:</label>
		  <p>{{ user_to_show.first_name }}</p>
		</div>
		<div class="clearfix after">
		  <label for="id_last_name">{% trans "Last name" %}:</label>
		  <p>{{ user_to_show.last_name }}</p>
		</div>
	</div>
  </div>
{% endif %}

{% if user_to_show.get_profile.communication %}
  <div class="module">
	<h3 class="header">
	  {% trans 'Communication' %}
	</h3>
	<div class="body">
	  {% if user_to_show.get_profile.address %}
		<div class="clearfix after">
		  <label for="id_address">{% trans "Address" %}:</label>
		  {{ user_to_show.get_profile.address.get_addressstring|markdown }}
		</div>
	  {% endif %}
	  {% if user_to_show.get_profile.communication.url %}
		<div class="clearfix after">
		  <label for="id_first_name">{% trans "Homepage" %}:</label>
		  <p>{{ user_to_show.get_profile.communication.url|urlizetrunc:30 }}</p>
		</div>
	  {% endif %}
	  {% if user_to_show.get_profile.communication.email %}
		<div class="clearfix after">
		  <label for="id_first_name">{% trans "E-mail" %}:</label>
		  <p><a href="mailto:{{ user_to_show.get_profile.communication.email }}">{{ user_to_show.get_profile.communication.email }}</a></p>
		</div>
	  {% endif %}
	  {% if user_to_show.get_profile.communication.phone_landline %}
		<div class="clearfix after">
		  <label for="id_first_name">{% trans "Telephone" %}:</label>
		  <p>{{ user_to_show.get_profile.communication.phone_landline }}</p>
		</div>
	  {% endif %}
	  {% if user_to_show.get_profile.communication.phone_mobile %}
		<div class="clearfix after">
		  <label for="id_first_name">{% trans "Telephone (mobile)" %}:</label>
		  <p>{{ user_to_show.get_profile.communication.phone_mobile }}</p>
		</div>
	  {% endif %}
	  {% if user_to_show.get_profile.communication.fax %}
		<div class="clearfix after">
		  <label for="id_first_name">{% trans "Fax" %}:</label>
		  <p>{{ user_to_show.get_profile.communication.fax }}</p>
		</div>
	  {% endif %}
	</div>
  </div>
{% endif %}

{% if departments %}
  <div class="module">
	<h3 class="header">
	  <a id="departments-pointer"
         href="javascript:inhouse.toggle_section('departments');"
         class="toggled-section ">
        <span id="departments-image"
              class="sprite plus">
        </span>
        {% trans 'Departments' %}
      </a>
	</h3>
	<div class="body" id="departments" style="display:none;">
	  <div class="clearfix after">
		{% for department in departments %}
		  <p>{{ department }}<p>
		{% endfor %}
	  </div>
	</div>
  </div>
{% endif %}

{% if projects %}
  <div class="module">
	<h3 class="header">
	  <a id="projects-pointer"
         href="javascript:inhouse.toggle_section('projects');"
         class="toggled-section ">
        <span id="projects-image"
              class="sprite plus">
        </span>
        {% trans 'Projects' %}
      </a>
	</h3>
	<div class="body" id="projects" style="display:none;">
	  <div class="clearfix after">
		{% for project in projects %}
			<p><a href="{% url inhouse.views.show_project project.id %}">{{ project }}</a>
			{% if user_to_show == project.manager %}({% trans "Project lead" %}){% endif %}
			</p>
		{% endfor %}
	  </div>
	</div>
  </div>
{% endif %}

{% endblock %}
